<%@include file="startUpIncludes.jsp" %>
   <%--<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> --%> 
  <%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
        <title>
            Invoices
        </title>
    </head>
    <body class="stockSKUsPage">
    <jsp:include page="header.jsp" >
		<jsp:param value="true" name="loggedIn"/>
	</jsp:include>
    <div class="wrap">
	<div class="fitBG">
        <div class="main">
		<%@include file="basicLeftMenu.jsp" %>
            <div class="content">
				<jsp:include page="tabs.jsp" >
					<jsp:param value="invoice" name="currentPage"/>
				</jsp:include>
                <div class="tab-content">
                <h3>
                Invoices
                </h3>
				<div class="lead-view">
				</div>
                <div class="content-block">
                    <h4>Invoices</h4>
                    <div class="action-btns">
                    <shiro:hasRole name="invoiceAdd"><a href="new-invoice" class="form-btn">New Invoice</a></shiro:hasRole>
					<shiro:hasRole name="invoiceTaxAdd"><a href="new-invoice-tax" class="form-btn">Add Invoice Tax</a></shiro:hasRole>	
					<shiro:hasRole name="viewAllTaxes"><a href="invoice-taxes" class="form-btn">View All Taxes</a></shiro:hasRole>	
						<a href="new-invoice-tax" class="form-btn">New Invoice Tax</a>
						<a href="invoice-taxes" class="form-btn">Invoice's Taxes</a>
                    </div>
	                <c:choose>
	                <c:when test="${empty invoiceList}">
	                <div class="noData">No data to preview...</div>
	                </c:when>
	                <c:otherwise>
                    <div class="scroll-table">
                    <table class="recent-leads">
                        <thead>
                            <tr>
                                <th class="p40">Invoice Number</th>
                                <th class="p15">Contact</th>
                                <th class="p40">Action</th>
                                <th class="p15">Total</th>
                            </tr>
                        </thead>
                        <tbody>
    					<c:forEach items="${invoiceList}" var="item">
                            <tr class="even">
                            	<shiro:hasRole name="invoiceView"><td><a href="view-invoice.html?id=${item.id}">${item.code}</a></td></shiro:hasRole>
                                <td>${item.contact.fName} ${item.contact.lName}</td>
                                <td>
	                            <shiro:hasRole name="invoiceView"><td><a href="view-invoice.html?id=${item.id}">View</a></td></shiro:hasRole>
                                </td>
                                <td>${item.totalPrice}</td>
                            </tr>
                		</c:forEach>
                        </tbody>
                    </table>
                    </div>
                    </c:otherwise>
                    </c:choose>
                </div>
            </div>
        </div>
        
    <%@include file="footer.jspf" %>
    </div>
    </div>

    </body>
</html>